package nio;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.nio.channels.FileChannel;

public class FileCopyDemo6 {

	public static void main(String[] args) {
		try (FileChannel src = new FileInputStream("f1.txt").getChannel();
				FileChannel des = new FileOutputStream("f1_bak.txt").getChannel()) {
			src.transferTo(0, src.size(), des);
			//des.transferFrom(src, 0, src.size());
		} catch (Exception e) {
			// TODO: handle exception
		}
	}

}
